const { app, BrowserWindow } = require('electron');
function createWindow () {
    const win = new BrowserWindow({
      width: 800,
      height: 600,
      webPreferences: {
        nodeIntegration: true,	//启用nodejs
        enableRemoteModule: true,	//在electron 10以后的版本，默认是关闭的
        contextIsolation: false, //Electron 12版本之后将默认启用它，使用require()时要关闭contextIsolation
  
      },
    })
  
    win.loadFile('index.html')
    win.webContents.openDevTools()
  }

  app.whenReady().then(() => {
    createWindow()
    app.on('activate', function () {
        if (BrowserWindow.getAllWindows().length === 0) createWindow()
      })
  })

  app.on('window-all-closed', function () {
    if (process.platform !== 'darwin') app.quit()
  })

    